package com.coldworks.coldjoke.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import android.graphics.Bitmap;

/**
 * ListView 首页每一条子数据的实体类
 */
public class JokeModel implements Serializable {

	private static final long serialVersionUID = 2876907191864729153L;

	public static final int UNKNOWN = 0;
	public static final int LIKE = 1;
	public static final int DISLIKE = 2;
	public static final int LOADING = 3;

	private String jokeId;
	private int jokeIndex;
	private String time; // 发布时间
	private String jokeText; // 笑话文字
	private String imgUrl; // 图片网络地址
	private String imgPath; // 图片本地地址
	private Bitmap thumb; // 缩略图
	private String userId; // 发布者id
	private String userName; // 发布人名字
	private String userIcon; // 发布人头像地址
	private int goodNum; // 顶数目
	private int badNum; // 踩数目
	private int replyNum; // 评论数目
	private boolean read; // 是否已读
	private int liked;
	private int disliked;
	private List<ReplyModel> replyInfoList;
	private long replyRequestTime;

	public JokeModel() {
		jokeIndex = Integer.MAX_VALUE;
		imgUrl = "";
		imgPath = "";
		thumb = null;
		read = false;
		liked = -1;
		disliked = -1;
		replyInfoList = new ArrayList<ReplyModel>();
		replyRequestTime = 0;
	}

	public JokeModel(JokeModel pJokeModel) {
		jokeId = pJokeModel.jokeId;
		jokeIndex = pJokeModel.jokeIndex;
		time = pJokeModel.time;
		jokeText = pJokeModel.jokeText;
		imgUrl = pJokeModel.imgUrl;
		imgPath = pJokeModel.imgPath;
		thumb = null;
		userId = pJokeModel.userId;
		userIcon = pJokeModel.userIcon;
		userName = pJokeModel.userName;
		goodNum = pJokeModel.goodNum;
		badNum = pJokeModel.badNum;
		replyNum = pJokeModel.replyNum;
		read = pJokeModel.read;
		liked = pJokeModel.liked;
		disliked = pJokeModel.disliked;
		replyInfoList = new ArrayList<ReplyModel>();
		replyRequestTime = pJokeModel.replyRequestTime;
	}

	public List<ReplyModel> getReplyInfoList() {
		return replyInfoList;
	}

	public void setReplyInfoList(List<ReplyModel> replyInfoList) {
		this.replyInfoList = replyInfoList;
	}

	public String getJokeId() {
		return jokeId;
	}

	public void setJokeId(String jokeId) {
		this.jokeId = jokeId;
	}

	public int getJokeIndex() {
		return jokeIndex;
	}

	public void setJokeIndex(int jokeIndex) {
		this.jokeIndex = jokeIndex;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserIcon() {
		return userIcon;
	}

	public void setUserIcon(String userIcon) {
		this.userIcon = userIcon;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	/**
	 * 线上图片地址
	 */
	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	public Bitmap getThumb() {
		return thumb;
	}

	public void setThumb(Bitmap thumb) {
		this.thumb = thumb;
	}

	public void clearThumb() {
		if (thumb == null) {
			return;
		}
		this.thumb.recycle();
		this.thumb = null;
	}

	/**
	 * 本地图片URL的绝对地址
	 */
	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	/**
	 * 是否有图片
	 */
	public boolean hasImage() {
		return !imgPath.equals("");
	}

	/**
	 * 笑话内容
	 */
	public String getJokeText() {
		return jokeText;
	}

	public void setJokeText(String jokeText) {
		this.jokeText = jokeText;
	}

	public int getGoodNum() {
		return goodNum;
	}

	public void setGoodNum(int goodNum) {
		this.goodNum = goodNum;
	}

	public int getBadNum() {
		return badNum;
	}

	public void setBadNum(int badNum) {
		this.badNum = badNum;
	}

	public int getReplyNum() {
		return replyNum;
	}

	public void setReplyNum(int replyNum) {
		this.replyNum = replyNum;
	}

	public int getLiked() {
		return liked;
	}

	public void setLiked(int liked) {
		this.liked = liked;
	}

	public int getDisliked() {
		return disliked;
	}

	public void setDisliked(int disliked) {
		this.disliked = disliked;
	}

	public boolean getRead() {
		return read;
	}

	public void setRead(boolean read) {
		this.read = read;
	}

	public long getReplyRequestTime() {
		return replyRequestTime;
	}

	public void setReplyRequestTime(long replyRequestTime) {
		this.replyRequestTime = replyRequestTime;
	}

}
